php associative array

38

$array = array_values($array);
$arr = array('lang1' => 'php','lang2' => 'java','lang3' => 'python');

if ( in_array( 'java', $arr ) ) {

  echo 'exists';

}else{

  echo 'not exists';

}
<?php
$arr = array('fruit' => 'mango', 'vegetable' => 'tomato', 'thing' => 'bag');
echo $arr['fruit'];
/*OUTPUT
mango*/
?>
Array
(
    [Ahmed] => Rofy
    [Abdallah] => Oda
    [Michel] => Mic
    [Yahia] => ENG
)
<?php
$arr = array('fruit' => 'mango', 'vegetable' => 'tomato', 'thing' => 'bag');
echo $arr[1]
//OUTPUT
//mango
?>

Comments

Submit
0 Comments